package com.cn.team.service.impl;

import com.cn.common.pojo.ResultModel;
import com.cn.common.pojo.TeamModel;
import com.cn.team.mapper.TeamDao;
import com.cn.team.service.TeamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TeamServiceImpl implements TeamService {
    @Autowired
    TeamDao teamDao;

    @Override
    public ResultModel team() {
        return ResultModel.Data(teamDao.team());
    }

    @Override
    public ResultModel teamForHome() {

        return ResultModel.Data(teamDao.teamForHome());
    }

    @Override
    public ResultModel delete(int id) {
        return ResultModel.getResultModelByCount(teamDao.delete(id));
    }

    @Override
    public ResultModel update(TeamModel teamModel) {
        return ResultModel.getResultModelByCount(teamDao.update(teamModel));
    }

    @Override
    public ResultModel insert(TeamModel teamModel) {
        return ResultModel.getResultModelByCount(teamDao.insert(teamModel));
    }

    @Override
    public ResultModel enable(int id) {
        return ResultModel.getResultModelByCount(teamDao.enable(id));
    }

    @Override
    public ResultModel findById(int id) {
        return ResultModel.getResultModelByAll(teamDao.findById(id),1);
    }

    @Override
    public ResultModel limit(TeamModel teamModel) {
        return ResultModel.getResultModel("",0,1,teamDao.limit(teamModel));
    }
}
